home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 050a.dms / 050a.adf / TEXTS / hints_and_tips.txt < prev    next >
Text File  |  1992-02-26  |  9KB  |  178 lines

  1.                                 HINTS AND TIPS
  2.                                 --------------
  3.  
  4. Following are a few hints and tips donated by readers of F1 Licenceware's
  5. Amos programmers disk mag, Amoszine. See Amos contacts for more details. 
  6. -------------------------------------------------------------------------
  7.  
  8. To find out how your program would run under the American NTSC
  9. system just enter this at the start of your listing:
  10.  
  11. Doke $DFF1DC,0
  12.  
  13. To return back to the PAL system use this:
  14.  
  15. Doke $DFF1DC,32
  16.  
  17. You could use these dokes as a switch inside your program making it
  18. almost world-wide compatible.
  19.  
  20. Don't use multiple if's 
  21.   
  22. For example.
  23.  
  24. If A=1 Then Proc A1
  25. If A=2 Then Proc A2
  26. If A=3 Then Proc A3
  27. If A=4 Then Proc A4
  28.  
  29. Can be replaced with. 
  30.  
  31. On A Proc A1,A2,A3,A4
  32.  
  33. Although this method cannot pass variables, it is much faster than using  
  34. multiple IF's with more conditions resulting in more of a gain in speed.  
  35.  
  36.  
  37. Save some memory
  38. ----------------
  39. SET SPRITE BUFFER 16  (If not using any sprites/bobs. saves about 10k)
  40.  
  41. CLOSE WORKBENCH       (saves around 40k)                              
  42.                                                                        
  43. CLOSE EDITOR          (saves about 26k)                               
  44.  
  45.                                               
  46. Is disk in DF0: write protected or not?                               
  47. ---------------------------------------                               
  48. POKE $BFD100,%10000      `Change to %1000 FOR DF1:                    
  49. A=BTST (3,$BFE001)                                                    
  50. IF A=-1 THEN PRINT "DISK WRITE ENABLED"                               
  51. IF A= 0 THEN PRINT "DISK WRITE PROTECTED"
  52.  
  53.                                                                        
  54. Change mouse pointer colours                                          
  55. ----------------------------                                          
  56. COLOUR 17,$FFF                                                        
  57. COLOUR 18,$123                                                        
  58. COLOUR 19,$0
  59.  
  60. Obviously change the $rgb values to what you want.
  61.  
  62.                                                                        
  63. Print a line of anything                                              
  64. ------------------------                                              
  65. PRINT STRING$ ("^",80)    ` will print 80 ^ on screen                 
  66. PRINT SPACE$ (80)          `Will print 80 spaces                      
  67.  
  68. Note:                                                                 
  69. You can put anything inside the " " of the first line and change the 
  70. 80 to any number you wish the equivalent line to be:
  71.  
  72.  PRINT"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^etc"
  73.  
  74.                                                                        
  75. Clear just a portion of the screen                                    
  76. -----------------------------------                                   
  77. CLS 12,14,39 to 305,70                                                
  78.                                                                        
  79. The 12 is a colour                                                    
  80. the 14,39 is the top right coordinates of the portion to clear        
  81. and the 305,70 is the bottom left coordinates                         
  82.  
  83. This can be a very useful command but is overlooked by a lot of people
  84.  
  85.                                                                        
  86. Display palette                                                       
  87. ---------------                                                       
  88. Here is a neat little four liner that will display the colours of the 
  89. current palette in use, like in an art package.                       
  90.                                                                        
  91. FOR L=0 TO 15: INK L                `set to loop 16 times 0-15        
  92. BAR (L+1)*16,170 TO (L+2)*16,177    `Draw a filled box in INK colour(L
  93. NEXT L                              `If L is less than 15 repeat loop 
  94. STOP                                `Loop finished                    
  95.                                                                        
  96. This will draw 16 filled boxes using the BAR instruction.             
  97. each box will be filled with the current INK colour which is changed by
  98. the FOR NEXT loop using INK L, L starts off with the value 0 and
  99. every time the program hits the NEXT L line it checks L is less than 15
  100. and if so adds 1 to L, when L eventually is equal to 15 the loop is 
  101. completed and the STOP instruction is executed ending the program.
  102.  
  103.  
  104. Screen wipe                                                           
  105. -----------------
  106. This is the screen wipe used on the loading screen of Amoszine 1.       
  107.  
  108. INK 0                                                                 
  109. FOR X=0 TO 319                                                        
  110. DRAW 0,199 TO X,0                                                     
  111. NEXT X                                                                
  112. FOR Y=1 TO 199                                                        
  113. DRAW 0,199 TO 319,Y                                                   
  114. NEXT Y
  115.  
  116.                                                                        
  117. Centre Text V2                                                        
  118. --------------                                                        
  119. This is a handy routine that will centre any text inside T$ on to the 
  120. screen This works for both horizontally and vertically, unlike the 
  121. CENTRE command. 
  122.                                                                        
  123. T$="MONGOLIAN INTRUDERS FROM PLANET RED"         ` Put some text in T$
  124. A=LEN(T$)                                        ` How long is it?    
  125. TEXT SCREEN WIDTH/2 - (A*8/2), SCREEN HEIGHT/2,T$` See below          
  126.                                                                        
  127. First we put the message we want printed into T$ and then A is told to
  128. hold the length of T$.                                                
  129.                                                                        
  130. TEXT is very similar to print except it can place the TEXT cursor 
  131. anywhere on screen to a pixel, where as LOCATE and PRINT can only be 
  132. defined by 8 pixels (or one character square if you like.)            
  133.                                                                        
  134. SCREEN WIDTH returns the WIDTH of the SCREEN and SCREEN HEIGHT does 
  135. what you would expect.  The calculation performed gives the exact 
  136. central x,y position on the screen to place the text in T$, for example
  137. SCREEN HEIGHT/2 will be exactly half way down the screen, 
  138. SCREEN WIDTH/2 half way across.   
  139.                                                                        
  140.                                                                        
  141. This is the routine Lee Bamber wrote for the clock we use in Amoszine.
  142. ----------------------------------------------------------------------
  143. REM Clock, By Lee Bamber for Amoszine                                 
  144.                                                                        
  145. REM Set up vars for hours minutes and seconds                         
  146. Time=Timer:Times=0:Timem=0:Timeh=0                                    
  147.                                                                        
  148. Rem your main loop                                                    
  149.                                                                        
  150. Do                                                                    
  151. Gosub CONSTRUCT_TIME                                                  
  152. Loop                                                                  
  153.                                                                        
  154. REM The subroutine                                                    
  155.                                                                        
  156. CONSTRUCT_TIME:                                                       
  157. Time$=((Timer-time)/50)
  158. If Times>=60                                                          
  159.    Times=0:Time=Timer                                                 
  160.    Inc Timem                                                          
  161. If Timem>=60                                                          
  162.    Timem=0                                                            
  163.    Inc timeh                                                          
  164. Endif                                                                 
  165. Endif                                                                 
  166.                                                                        
  167. REM The following two lines should be all on one, 
  168.     I couldn't fit it on here.
  169.  
  170. Time$=Mid$(Str$(100+Timeh),3,2)+":"+Mid$(Str$(100+Timem),3,2)+":"+Mid$
  171. (Str$(100+Times),3,2                                                  
  172.                                                                        
  173. Pen 1:Paper 0:Home:Print Time$                                        
  174. Return                                                                
  175.                                                                          
  176.                             END OF HINTS AND TIPS
  177.                             ^^^^^^^^^^^^^^^^^^^^^
  178.